import request from '@/router/axios';

// 查询砍价活动参与对象列表
export function listActivity(query) {
  return request({
    url: '/promotion/activity/list',
    method: 'get',
    params: query,
  });
}

// 查询砍价活动参与对象详细
export function getActivity(id) {
  return request({
    url: '/promotion/activity/' + id,
    method: 'get',
  });
}

// 新增砍价活动参与对象
export function addActivity(data) {
  return request({
    url: '/promotion/activity',
    method: 'post',
    data: data,
  });
}

// 修改砍价活动参与对象
export function updateActivity(data) {
  return request({
    url: '/promotion/activity',
    method: 'put',
    data: data,
  });
}

// 删除砍价活动参与对象
export function delActivity(id) {
  return request({
    url: '/promotion/activity/' + id,
    method: 'delete',
  });
}

// 获取当前进行中的促销活动
export function getAllPromotion(params) {
  return request({
    url: '/promotion/manager/promotion/current',
    method: 'get',
    params: params,
  });
}

//  获取单个优惠券
export function getPlatformCoupon(id) {
  return request({
    url: `/promotion/manager/promotion/coupon/${id}`,
    method: 'get',
  });
}

// 修改平台优惠券
export function editPlatformCoupon(params) {
  return request({
    url: `/promotion/manager/promotion/coupon`,
    method: 'put',
    data: params,
  });
}

// 获取秒杀活动申请列表
export function getPromotionSeckill(params) {
  return request({
    url: `/promotion/manager/promotion/seckill/apply`,
    method: 'get',
    params: params,
  });
}

// 秒杀活动中商品删除
export function delSeckillGoods(params) {
  return request({
    url: `/promotion/manager/promotion/seckill/apply/${params.seckillId}/${params.id}`,
    method: 'delete',
  });
}
